<?php

/*
	Class: CommerceMagentoNewsletter

	About: Author
		Rich Joslin

	About: License
		<http://communit.as/docs/license>
*/
class CommerceMagentoNewsletter extends Commerce_Db_Model_Magento {

	/* Group: Instance Methods */

	/*
		Function: isCustomerSubscribed
	*/
	function isCustomerSubscribed($customer_id) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'newsletter.isCustomerSubscribed',
			array($customer_id)
		);
	}

	/*
		Function: isEmailSubscribed
	*/
	function isEmailSubscribed($email_address) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'newsletter.isEmailSubscribed',
			array($email_address)
		);
	}

	/*
		Function: subscribe
	*/
	function subscribe($email_address) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'newsletter.subscribe',
			array($email_address)
		);
	}

	/*
		Function: unsubscribe
	*/
	function unsubscribe($email_address) {
		$this->initSoap();
		return $this->client->call(
			$this->_api_session_id,
			'newsletter.unsubscribe',
			array($email_address)
		);
	}

}
